<template>
  <el-dialog v-dialogDrag title="增加" :visible="isShowAddDialog" width="70%" @close="dialogClose">
    <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="110px">

      <el-form-item label="模块名称" prop="name">
        <el-input v-model="ruleForm.name"></el-input>
      </el-form-item>

      <el-form-item label="模块描述" prop="describe">
        <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="ruleForm.describe">
        </el-input>
      </el-form-item>

      <el-form-item label="跳转路径" prop="path">
        <el-input v-model="ruleForm.path"></el-input>
      </el-form-item>


    </el-form>

    <span slot="footer" class="dialog-footer">
      <el-button @click="dialogClose">取 消</el-button>
      <el-button type="primary" @click="submitForm()">确 定</el-button>
    </span>

  </el-dialog>
</template>

<script>
export default {
  data() {
    return {
      textarea: '',
      ruleForm: {
        name: '',
        describe: '',
        path: '',
      },
      rules: {
        name: [
          { required: true, message: '请输入用户名', trigger: 'blur' }
        ],
        describe: [
          { required: true, message: '请输入手机号', trigger: 'blur' }
        ],
        path: [
          { required: true, message: '请选择菜单权限', trigger: 'blur' }
        ],
      },
    };

  },
  props: {
    isShowAddDialog: {
      type: Boolean
    }
  },

  methods: {

    dialogClose() {
      this.$emit('dialogClose')
    },
    submitForm() {
      this.$refs.ruleForm.validate((valid) => {
        if (!valid) {
          return
        }
        else {
          this.$emit('dialogClose')
        }
      });
    },
    },
  }


</script>

<style>

</style>
